package com.example.demo.设计模式.代理模式.JDK代理;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyHandler implements InvocationHandler {
    private Object target;

    public void setTarget(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("before do ...");
        Object invoke = method.invoke(target, args);
        System.out.println("after do ...");
        return invoke;
    }
}
